package gui.menu.actions;

import gui.Frame;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;

public class NewAction extends AbstractAction
{
   private static Icon icon = new ImageIcon("icons/new.png");
   /**
    * 
    */
   private static final long serialVersionUID = 1L;
   private Frame frame;
   /** Create this action for the given frame */
   public NewAction(Frame frame)
   {
      super("New",icon);
      this.frame = frame;
   }

   @Override
   public void actionPerformed(ActionEvent ae)
   {
      int n = JOptionPane.showConfirmDialog(
            frame,
            "Do you want save current document",
            "New Document",
            JOptionPane.YES_NO_OPTION);
      System.out.println(n);
      if(n==1)
         frame.NewView();
   }

   public void setText(String Text)
   {
      setText(Text);
   }

}
